const fetch = require('../../utils/fetch.js')
// pages/detail/detail.js
Page({

  data: {
    id:0,
    shop:{}
  },
  onLoad: function (options) {
    this.setData({id:this.options.item})
  },

  onReady: function () {
    // console.log(this.data.id)
    fetch(`shops/${this.data.id}`).then(res => { 
      this.setData({shop:res.data})
      wx.setNavigationBarTitle({
        title: res.data.name,
      })
    })
  },
  previewHandle: function(e){
    wx.previewImage({
      current:e.target.dataset.src,
      urls: this.data.shop.images
    })
  }
})